import React, { useState } from 'react'
import CommonModal from '@/common/CommonModal'
import CommonRadioButton from '@/common/CommonRadioButton'
import Modal from './Modal'
import { buttonConfig, Components } from './config'

const StudyModal = () => {
  const [visible, setVisible] = useState(false)

  const handlerClick = () => {
    setVisible(true)
  }
  const handlerOnCancel = () => {
    setVisible(false)
  }
  const modalProps = {
    title: 'Basic Modal',
    onCancel: handlerOnCancel,
    visible,
    component: Modal,
    width: '50%',
  }

  const radioButtonProps = {
    options: buttonConfig,
    Components,
  }
  return (
    <div>
      <div onClick={handlerClick}>打开Modal</div>
      <CommonModal {...modalProps} />
      <CommonRadioButton {...radioButtonProps} />
    </div>
  )
}

export default StudyModal
